<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:output method="xml" indent="yes" encoding="UTF-8"
        doctype-public="-//W3C//DTD XHTML 1.1//EN"
        doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"/>
    <xsl:key name="person" match="/nagrody_turinga/naukowcy/naukowiec" use="@id"/>
    <xsl:template match="/nagrody_turinga">
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
            <head>
                <title>Zdobywcy nagrody TURINGA (LOEBNERA)</title>
                <link rel="stylesheet" type="text/css" href="kozerski.css"/>
                <link rel="alternate" type="application/atom+xml" href="rss.xml"
                    title="Informacje o nowych nagrodach"/>
                <script src="kozerski.js" type="text/javascript">s</script>
                <meta http-equiv="Content-type" content="application/xhtml+xml; charset=UTF-8"/>
            </head>
            <body>
                <xsl:for-each select="nagrody/nagroda">
                    <xsl:sort data-type="number" select="@rok" order="descending"/>
                    <xsl:variable name="id" select="@rok"/>
                    <xsl:variable name="tags">
                        <xsl:for-each select="kategoria">
                            <xsl:value-of select="concat(., &quot; &quot;)"/>
                        </xsl:for-each>
                    </xsl:variable>
                    <div class="price" title="{$tags}" id="price{$id}">
                        <div class="year" id="r{$id}">
                            <xsl:value-of select="@rok"/>
                        </div>
                        <div class="right">
                            <div class="title">
                                <xsl:value-of select="uzasadnienie"/>
                            </div>
                            <span class="tags">| <xsl:for-each select="kategoria">
                                    <xsl:variable name="kategoria" select="."/>
                                    <a href="#" onclick="showTags(&quot;{$kategoria}&quot;)">
                                        <xsl:value-of select="."/>
                                    </a>
                                    <xsl:text> | </xsl:text>
                                </xsl:for-each>
                            </span>
                            <xsl:for-each select="nagrodzony/key('person', @id_naukowca)">
                                <div class="winner">
                                    <xsl:variable name="foto" select="zdjecie/@src"/>
                                    <xsl:variable name="name" select="nazwisko"/>
                                    <img src="{$foto}" alt="{$name}"/>
                                    <xsl:variable name="flag" select="urodzony"/>
                                    <span class="name"
                                        style="background-image: url(flags/{$flag}.png);">
                                        <xsl:for-each select="imie">
                                            <xsl:value-of select="."/>
                                            <xsl:text> </xsl:text>
                                        </xsl:for-each>
                                        <xsl:value-of select="nazwisko"/>
                                    </span>
                                    <span>urodzon<xsl:if test="@plec=&quot;K&quot;"
                                            >a</xsl:if><xsl:if test="@plec=&quot;M&quot;"
                                        >y</xsl:if>: <xsl:value-of
                                            select="format-date(urodzony/@data, &quot;[D1].[MI].[Y]&quot;)"
                                        />
                                    </span>
                                    <span>
                                        <xsl:if test="zmarl">zmarł<xsl:if
                                                test="@plec=&quot;K&quot;">a</xsl:if>:
                                                <xsl:value-of
                                                select="format-date(zmarl/@data, &quot;[D1].[MI].[Y]&quot;)"
                                            /></xsl:if>
                                    </span>
                                    <xsl:if test="inna_nagroda">
                                        <span>
                                            <b>Inne nagrody:</b>
                                        </span>
                                        <ul>
                                            <xsl:for-each select="inna_nagroda">
                                                <li>
                                                  <xsl:value-of select="."/>
                                                  <xsl:if test="@rok"> [<xsl:value-of
                                                  select="@rok"/>]</xsl:if>
                                                </li>
                                            </xsl:for-each>
                                        </ul>
                                    </xsl:if>
                                    <xsl:if test="publikacja">
                                        <span>
                                            <b>Ważniejsze publikacje:</b>
                                        </span>
                                        <ul>
                                            <xsl:for-each select="publikacja">
                                                <li>
                                                  <xsl:value-of select="."/>
                                                  <xsl:if test="@rok"> [<xsl:value-of
                                                  select="@rok"/>]</xsl:if>
                                                </li>
                                            </xsl:for-each>
                                        </ul>
                                    </xsl:if>
                                    <span>Źródła: <xsl:for-each select="zrodla">
                                            <xsl:text> </xsl:text>
                                            <xsl:variable name="source" select="./@src"/>
                                            <a href="{$source}">[&lt;<xsl:value-of
                                                  select="1+count(preceding-sibling::zrodla)"
                                                />&gt;]</a>
                                        </xsl:for-each>
                                    </span>
                                </div>
                            </xsl:for-each>
                        </div>
                    </div>
                </xsl:for-each>
                <dl>
                    <dt>Źródła danych:</dt>
                    <dd>Oficjalna strona <a
                            href="http://awards.acm.org/homepage.cfm?srt=all&amp;awd=140"
                            >nagrody TURINGA</a>
                    </dd>
                    <dd>Wolna encyklopedia <a href="http://pl.wikipedia.org/wiki/Nagroda_Turinga"
                            >Wikipedia</a></dd>
                    <dt>Tagi:</dt>
                    <dd>
                        <a href="#" onclick="showAll()" class="mark">Wszystkie</a>
                    </dd>
                    <xsl:for-each select="nagrody/nagroda/kategoria">
                        <xsl:sort data-type="text" select="." order="ascending"/>
                        <dd>
                            <xsl:variable name="kategoria" select="."/>
                            <a href="#" onclick="showTags(&quot;{$kategoria}&quot;)">
                                <xsl:value-of select=".[not(.=preceding::kategoria)]"/>
                            </a>
                        </dd>
                    </xsl:for-each>
                </dl>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>
